var spider_host = "http://www.spider.com.cn";
var newrightimg = "";
var newerrorimg = "";

function newshowrgsttips(id){
	if(id == 'pwd_tip' || id == 'mobilepwd_tip'){
		$("#"+id).html("6~16个字符（字母，数字），区分大小写");
		$("#"+id).show();
	}else if(id == 'repwd_tip' || id == 'mobilerepwd_tip'){
		$("#"+id).html("请再输一遍您要设置的密码");
		$("#"+id).show();
	}else if(id == 'mobile_tip'){
		$("#"+id).html("请填写有效的手机号码作为登录用户名");
		$("#"+id).show();
	}
	else if(id == 'email_tip'){
		$("#"+id).html("请输入有效email地址，登录及找回密码用");
		$("#"+id).show();
	}
	else if(id =='mobile_code_tip'){
		$("#"+id).html("请填写6位数字验证码");
		$("#"+id).show();
	}
	
}

var emailreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
function newcheckemail(valueid,tipid){
	var isOk = false;
	var email = $("#" + valueid).val();
	if(null == email || '' == email){
		$("#"+tipid).html("请输入电子邮箱");
		$("#" + valueid).focus();
	}else if(!emailreg.test(email)){
		$("#"+tipid).html("您输入的电子邮箱地址格式不正确");
		$("#" + valueid).focus();
	}else{
		isOk = true;
		$("#"+tipid).html("");
	}
	return isOk;
}
var pwdreg = /^(\w|,){6,16}/;
function newcheckpwd(valueid,tipid){
	var isOk = false;
	var pwd	= $("#" + valueid).val();
	if(null == pwd || '' == pwd){
		$("#"+tipid).html("请设置密码");
		$("#" + valueid).focus();
	}else if(!pwdreg.test(pwd)){
		$("#"+tipid).html("请使用6~16位数字/字母");
		$("#" + valueid).focus();
	}else{
		isOk = true;
		$("#"+tipid).html("");
	}
	return isOk;
}
function newcheckrepwd(valueid,tipid,pwdid){
	var isOk = false;
	var pwd = $("#" + valueid).val();
	var repwd = $("#" + pwdid).val();
	if(null == repwd || '' == repwd){
		$("#"+tipid).html("请确认设置的密码");
		$("#" + pwdid).focus();
	}else if(!pwdreg.test(repwd)){
		$("#"+tipid).html("请使用6~16位数字/字母");
		$("#" + pwdid).focus();
	}else if(pwd != repwd){
		$("#"+tipid).html("两次密码输入不一致");
		$("#" + pwdid).focus();
	}else{
		isOk = true;
		$("#"+tipid).html("");
	}
	return isOk;
}
function newcheckverifycode(valueid,tipid){
	var isOk = false;
	var verifycode = $("#" + valueid).val();
	if(null == verifycode || '' == verifycode){
		$("#"+tipid).html("请输入验证码");
		$("#" + valueid).focus();
	}else if(verifycode.length < 4){
		$("#"+tipid).html("验证码长度有误");
		$("#" + valueid).focus();
	}else{
		isOk = true;
		$("#"+tipid).html("");
	}
	return isOk;
}
function newcheckagreement(valueid,tipid){
	var isOk = false;
	var agreeflag = "n";
	if($('#'+ valueid).is(':checked')){
    	agreeflag = "y";
	}
	if(agreeflag != 'y'){
		$("#"+tipid).html("很抱歉，您必须同意蜘蛛网用户注册协议后才能注册");
	}else{
		$("#"+tipid).html("");
		isOk = true;
	}
	return isOk;
}

function newcheckmobilecode(valueid,tipid){
	var isOk = false;
	var mobilecode = $("#" + valueid).val();
	if(null != mobilecode && '' != mobilecode){
		if(mobilecode.length < 6){
			$("#"+tipid).html("请输入正确的短信验证码");
			$("#" + valueid).focus();
		}else{
			isOk = true;
			$("#"+tipid).html("");
		}
	}else{
		$("#"+tipid).html("请输入短信验证码");
		$("#" + valueid).focus();
	}
	return isOk;
}

var pwdReg = /(?![^a-zA-Z0-9]+$)(?![^a-zA-Z/D]+$)(?![^0-9/D]+$).{6,16}$/;
function pwdVerify(pwd,tipid,pwdid){
	var isOk = false;
	if(!pwdReg.test(pwd)){
		$("#"+tipid).html("请使用6~16位数字、字母组合密码");
		$("#" + pwdid).focus();
	}else{
		isOk = true;
		$("#"+tipid).html("");
	}
	return isOk;
}

/**验证邮箱注册**/
function checkRegisterEmailForm(){
	$("#mailInput_tip").html("");
	$("#pwdInput_tip").html("");
	$("#pwdRepeat_tip").html("");
	$("#reshcode_tip").html("");
	var email = $("#mailInput").val();
	var verifycode = $("#reshcode").val();
	if(!newcheckemail("mailInput","mailInput_tip") || !newcheckpwd("pwdInput","pwdInput_tip") || !newcheckrepwd("pwdInput","pwdRepeat_tip","pwdRepeat") 
		|| !newcheckverifycode("reshcode","reshcode_tip") ||  !newcheckagreement("agree","agree_tip")){
		return;
	}
	if(!pwdVerify($("#pwdInput").val(),"pwdInput_tip","pwdRepeat")){
		return;
	}
	if($("#pwdInput").val().indexOf("&") > -1 || $("#pwdInput").val().indexOf("#") > -1){
		$("#pwdInput_tip").html("密码不能包含&或#字符");
		$("#pwdInput").focus();
	 	return false;
	}
	$("#clickregisteremail").html("<a id=\"registeremailbutton\" href=\"javascript:void(0)\" class=\"btn_red2 f14\">立即注册</a>");
	/**检查email是否存在**/
	var url_remote = "register.action?useremail=" + email + "&reshcode=" + verifycode + "&registertype=registertype";
	url_remote = encodeURI(url_remote);
	$.post(url_remote, null, function(data){
		var items = data.getElementsByTagName("item");
		var bool = items[0].childNodes[0].nodeValue;
		if(bool == "success"){
	        var url_remote = "userJquery.action?commonType=user003&pjcode="+verifycode;
	        url_remote = encodeURI(url_remote);
			$.post(url_remote, null, function(data) {
				var items1 = data.getElementsByTagName("item");
				var result = items1[0].childNodes[0].nodeValue;//验证码
				if("401" == result){
					$("#clickregisteremail").html("<a id=\"registeremailbutton\" href=\"javascript:void(0)\" onclick=\"checkRegisterEmailForm()\" class=\"btn_red2 f14\">立即注册</a>");
					randomidbetter(document.registerform.verifycode);
					$("#reshcode").focus();
					$("#reshcode_tip").html("验证码错误");
					return;
				}
				document.registerform.action = spider_host + "/userregister.html?returnurl="+encodeURIComponent(location.href);
				document.registerform.submit();
			});
		}else{
			randomidbetter(document.registerform.verifycode);
			$("#clickregisteremail").html("<a id=\"registeremailbutton\" href=\"javascript:void(0)\" onclick=\"checkRegisterEmailForm()\" class=\"btn_red2 f14\">立即注册</a>");
			if(bool == "error1"){
				$("#reshcode").focus();
				$("#reshcode_tip").html("验证码错误");
			}else if(bool == "error2"){
				var urltemp = getUrlParam("returnurl");
				$("#mailInput_tip").html("您输入的邮箱已注册，<a href=\"" + spider_host + "/forgetPassword.html?returnurl=" + urltemp + "\" class=\"blue1\">忘记密码？</a>");
				$("#mailInput").focus();
			}else if(bool == "error3"){
				$("#reshcode_tip").html("访问太频繁了，休息下吧");
				$("#reshcode").focus();
			}else{
				$("#reshcode_tip").html("系统繁忙，请稍后再试");
				$("#reshcode").focus();
			}
		}
	});
}

var mobilereg=/^1[3|4|5|7|8]\d{9}$/;
function newcheckmobile(valueid,tipid){
	var isOk = false;
	var mobile = $("#" + valueid).val();
	if(null == mobile || '' == mobile){
		$("#"+tipid).html("请输入手机号");
		$("#" + valueid).focus();
	}else if(!mobilereg.test(mobile)){
		$("#"+tipid).html("请检查您输入的手机");
		$("#" + valueid).focus();
	}else{
		isOk = true;
		$("#"+tipid).html("");
	}
	return isOk;
}
/**注册页面获取手机验证码**/
var mobilecodetime = 100;
var getmobilecodehander = null;
function getmobilecode(btnid,tipid,mobileid){
	var isOk = false;
	var mobile = $("#" + mobileid).val();
	var reshcode = $("#reshcode").val();
	if(null == mobile || '' == mobile){
		$("#"+tipid).html("请输入手机号");
		$("#phoneNum").focus();
	}else if(!mobilereg.test(mobile)){
		$("#"+tipid).html("请检查您输入的手机");
		$("#phoneNum").focus();
	}else if(null == reshcode || '' == reshcode){
		$("#phoneNum_tip").html("请输入验证码");
		$("#reshcode").focus();
	}else{
		/**检查 验证码正确性及手机号是否存在**/
		var url_remote = "register.action?useremail=" + mobile + "&reshcode=" + reshcode + "&registertype=registertype";
		url_remote = encodeURI(url_remote);
		$.post(url_remote, null, function(data){
			var items = data.getElementsByTagName("item");
			var result = items[0].childNodes[0].nodeValue;
			if(result == "success"){
				getmobilecodetime(btnid);
				isOk =  true;
				$("#"+tipid).html("");
				if(mobilecodetime <= 0){
					$("#sendsmsbutton").html("<a href=\"javascript:void(0)\" onclick=\"getmobilecode('btngetmobilecode','phoneNum_tip','phoneNum');\" id=\"btngetmobilecode\" class=\"btn_gray2 btnGet black1 f14\">获取短信动态码</a>");
				}else{
					$("#sendsmsbutton").html("<span class=\"btn_gray2 f14\">重新获取短信动态码（<em>" + mobilecodetime + "</em>）</span>");
				}
		        var url_remote = "userJquery.action?commonType=user001&mobile=" + mobile+"&flushcode="+reshcode;
				url_remote = encodeURI(url_remote);
				$.post(url_remote, null, function(data) {
					var items1 = data.getElementsByTagName("item");
			        var times = items1[0].childNodes[0].nodeValue;
			        if(times == 'success'){
			        	  	$("#"+tipid).html("验证码已发送请查收");
			                getmobilecodehander = setInterval(function() {
			                	if(mobilecodetime <= 0){
	                	            window.clearInterval(getmobilecodehander);
	                	            getmobilecodehander = null;
	                				$("#sendsmsbutton").html("<a href=\"javascript:void(0)\" onclick=\"getmobilecode('btngetmobilecode','phoneNum_tip','phoneNum');\" id=\"btngetmobilecode\" class=\"btn_gray2 btnGet black1 f14\">获取短信动态码</a>");
	                	            mobilecodetime = 100;
			                	 }else{
			                		$("#sendsmsbutton").html("<span class=\"btn_gray2 f14\">重新获取短信动态码（<em>" + mobilecodetime-- + "</em>）</span>");
			                	 }
			               }, 1000);
			        }else{
						getmobilecodehander = null;
						getmobilecodetime(btnid);
						getmobilecodehander = setInterval(function() {
							if(mobilecodetime <= 0) {
								window.clearInterval(getmobilecodehander);
								getmobilecodehander = null;
								$("#sendsmsbutton").html("<a href=\"javascript:void(0)\" onclick=\"getmobilecode('btngetmobilecode','phoneNum_tip','phoneNum');\" id=\"btngetmobilecode\" class=\"btn_gray2 btnGet black1 f14\">获取短信动态码</a>");
								mobilecodetime = 100;
							}else{
								$("#sendsmsbutton").html("<span class=\"btn_gray2 f14\">重新获取短信动态码（<em>" + mobilecodetime-- + "</em>）</span>");
							}
						}, 1000);
			        }
				});
			}else{
				randomidbetter(document.registerform.verifycode);
				if(result == "error1"){
					$("#phoneNum_tip").html("验证码错误");
					$("#reshcode").focus();
				}else if(result == "error2"){
					var urltemp = getUrlParam("returnurl");
					$("#phoneNum_tip").html("您输入的手机号已注册，<a href=\"" + spider_host + "/forgetPassword.html?returnurl=" + urltemp + "\" class=\"blue1\">忘记密码？</a>");
					$("#phoneNum").focus();
				}else if(result == "error3"){
					$("#phoneNum_tip").html("访问太频繁了，休息下吧");
					$("#reshcode").focus();
				}else{
					$("#phoneNum_tip").html("系统繁忙，请稍后再试");
					$("#reshcode").focus();
				}
			}
		});
	}
	return isOk;
}

function getmobilecodetime(btnid){
	mobilecodetime = 100;
    var url_remote = "userJquery.action?commonType=user007";
    url_remote = encodeURI(url_remote);
    $.post(url_remote, null, 
    function(data) {
        var items = data.getElementsByTagName("item");
        var valjq = items[0].childNodes[0].nodeValue;
        if(valjq == 'false'){
        	
        }else{
            mobilecodetime= valjq;
        }
    });
}

//手机号 注册
function checkRegisterMobileForm(){
	/**先清空之前的错误信息**/
	$("#phoneNum_tip").html("");
	$("#dtmNum_tip").html("");
	$("#pwdInput_tip").html("");
	$("#pwdRepeat_tip").html("");
	var email = $("#phoneNum").val();
	var verifycode = $("#reshcode").val();
	var mobile_code = $("#dtmNum").val();
	if(!newcheckmobile("phoneNum","phoneNum_tip") || !newcheckverifycode("reshcode","phoneNum_tip") || !newcheckmobilecode("dtmNum","dtmNum_tip") 
		|| !newcheckpwd("pwdInput","pwdInput_tip") || !newcheckrepwd("pwdInput","pwdRepeat_tip","pwdRepeat") || !newcheckagreement("agree","mobileagreement_tip")){
		return;
	}
	if(!pwdVerify($("#pwdInput").val(),"pwdInput_tip","pwdRepeat")){
		return;
	}
	if($("#pwdInput").val().indexOf("&") > -1 || $("#pwdInput").val().indexOf("#") > -1){
		$("#pwdInput_tip").html("密码不能包含&或#字符");
		$("#pwdInput").focus();
	 	return false;
	}
	$("#clickregistermobile").html("<a id=\"registermobilebutton\" href=\"javascript:void(0)\" class=\"btn_red2 f14\">立即注册</a>");
	/**检查 手机号 是否存在**/
	var url_remote = "register.action?useremail=" + email + "&reshcode=" + verifycode + "&registertype=registertype&verifytype=n";
	url_remote = encodeURI(url_remote);
	$.post(url_remote, null, function(data){
		var items = data.getElementsByTagName("item");
		var bool = items[0].childNodes[0].nodeValue;
		if(bool == "success"){
			var url_remote = "userJquery.action?commonType=preVerifySms";
	        var postData = {
	        	"pjcode":verifycode,
	        	"mobilecode":mobile_code,
	        	"mobile":email
	        };
	        $.post(url_remote, postData, function(data) {
				var items = data.getElementsByTagName("item");
				var result = items[0].childNodes[0].nodeValue;//验证码
				if(result == "401"){
					$("#clickregistermobile").html("<a id=\"registermobilebutton\" onclick=\"checkRegisterMobileForm()\" href=\"javascript:void(0)\" class=\"btn_red2 f14\">立即注册</a>");
					loadPicCode("newRegist");
					$("#phoneNum_tip").html("图片验证码错误");
					$("#reshcode").focus();
					return;
				}else if(result == "402"){
					$("#clickregistermobile").html("<a id=\"registermobilebutton\" onclick=\"checkRegisterMobileForm()\" href=\"javascript:void(0)\" class=\"btn_red2 f14\">立即注册</a>");
					loadPicCode("newRegist");
					$("#dtmNum_tip").html("请输入手机号或者短信验证码");
					$("#dtmNum").focus();
					return;
				}else if("success" != result){
					$("#clickregistermobile").html("<a id=\"registermobilebutton\" onclick=\"checkRegisterMobileForm()\" href=\"javascript:void(0)\" class=\"btn_red2 f14\">立即注册</a>");
					$("#dtmNum_tip").html(result);
					return;
				}
				document.registerform.action = window.location.href;//"userregister.html";
				document.registerform.submit();
			});
		}else{
			loadPicCode("newRegist");
			$("#clickregistermobile").html("<a id=\"registermobilebutton\" onclick=\"checkRegisterMobileForm()\" href=\"javascript:void(0)\" class=\"btn_red2 f14\">立即注册</a>");
			if(bool == "error1"){
				$("#phoneNum_tip").html("验证码错误");
				$("#reshcode").focus();
			}else if(bool == "error2"){
				var urltemp = getUrlParam("returnurl");
				$("#phoneNum_tip").html("您输入的手机号已注册，<a href=\"" + spider_host + "/forgetPassword.html?returnurl=" + urltemp + "\" class=\"blue1\">忘记密码？</a>");
				$("#phoneNum").focus();
			}else if(bool == "error3"){
				$("#dtmNum_tip").html("访问太频繁了，休息一会吧");
			}else{
				$("#phoneNum_tip").html("系统繁忙，请稍后再试");
				$("#reshcode").focus();
			}
		}
	});
}

function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return r[2]; return "http%3A%2F%2Fwww.spider.com.cn%2F";
}

function randomidbetter(obj) {
	obj.src = spider_host + "/verifycode.jsp?" + new Date;
}

/**找回密码**/
function forgetfirst(){
	var regname = $("#regname").val();
	var freshcode = $("#freshcode").val();
	if("" == regname || null == regname){
		$("#regname_tip").html("请输入你注册的邮箱/手机");
		$("#regname").focus();
		return false;
	}else if(!mobilereg.test(regname) && !emailreg.test(regname)){
		$("#regname_tip").html("您输入邮箱或手机格式错误");
		$("#regname").focus();
		return false;
	}else{
		$("#regname_tip").html("");
	}
	if("" == freshcode || null == freshcode){
		$("#freshcode_tip").html("请输入验证码");
		$("#freshcode").focus();
		return false;
	}else{
		$("#freshcode_tip").html("");
	}
	var url_remote = "userForgetVerify.action?usertype=first001&username="+regname+"&freshcode="+freshcode;
	url_remote = encodeURI(url_remote);
	$.post(url_remote, null, function(data) {
		var items = data.getElementsByTagName("item");
		var result = items[0].childNodes[0].nodeValue;
		if(result == 'success'){
			document.forgetform.action = spider_host + "/forgetPasswordStepTwo.html";
			document.forgetform.submit();
		}else if(result == 'error1'){
			randomidbetter(document.forgetform.verifycode_id);
			$("#regname_tip").html("请输入你注册的邮箱/手机");
			$("#regname").focus();
			return false;
		}else if(result == 'error2'){
			randomidbetter(document.forgetform.verifycode_id);
			$("#regname_tip").html("您输入邮箱或手机格式错误");
			$("#regname").focus();
			return false;
		}else if(result == 'error3'){
			randomidbetter(document.forgetform.verifycode_id);
			$("#freshcode_tip").html("请输入验证码");
			$("#freshcode").focus();
			return false;
		}else if(result == 'error4'){
			randomidbetter(document.forgetform.verifycode_id);
			$("#freshcode_tip").html("验证码错误");
			$("#freshcode").focus();
			return false;
		}else if(result == 'error5'){
			randomidbetter(document.forgetform.verifycode_id);
			var urltemp = getUrlParam("returnurl");
			$("#regname_tip").html("您输入的帐号不存在，请先<a href=\"" + spider_host + "/userregister.html?returnurl=" + urltemp + "\" class=\"blue1\">注册</a>");
			$("#regname").focus();
			return false;
		}else if(result == 'error6'){
			randomidbetter(document.forgetform.verifycode_id);
			$("#regname_tip").html("您的帐号存在异常，请致电客服400-1500-666 找回");
			$("#regname").focus();
			return false;
		}else{
			randomidbetter(document.forgetform.verifycode_id);
			$("#regname_tip").html("系统繁忙，请稍后再试");
			return false;
		}
	});
}

/**找回密码页面获取手机验证码**/
function getmobilecodecommon(btnid,tipid,mobileid){
	var isOk = false;
	var mobile = $("#" + mobileid).val();
	if(null == mobile || '' == mobile || !mobilereg.test(mobile)){
		$("#"+tipid).html("手机号有误，请重新按照流程找回密码");
	}else{
		getmobilecodetime(btnid);
		isOk = true;
		$("#"+tipid).html("");
		if(mobilecodetime <= 0){
			$("#sendsmsbutton").html("<a href=\"javascript:void(0)\" onclick=\"getmobilecodecommon('btngetmobilecode','dtmNum_tip','phoneNum');\" id=\"btngetmobilecode\" class=\"btn_gray2 btnGet black1 f14\">获取短信动态码</a>");
			$("#dtmNum_tip").html("");
		}else{
			$("#sendsmsbutton").html("<span class=\"btn_gray2 f14\">重新获取短信动态码（<em>" + mobilecodetime + "</em>）</span>");
		}
        var url_remote = "userJquery.action?commonType=user005&mobile=" + mobile+"&customersign="+$("#customersign").val()+"&verifytype=n";
		url_remote = encodeURI(url_remote);
		$.post(url_remote, null, function(data) {
			var items1 = data.getElementsByTagName("item");
	        var times = items1[0].childNodes[0].nodeValue;
	        if(times == 'success'){
	        	  	$("#"+tipid).html("验证码已发送请查收");
	                getmobilecodehander = setInterval(function() {
	                	if(mobilecodetime <= 0){
               	            window.clearInterval(getmobilecodehander);
               	            getmobilecodehander = null;
               				$("#sendsmsbutton").html("<a href=\"javascript:void(0)\" onclick=\"getmobilecodecommon('btngetmobilecode','phoneNum_tip','phoneNum');\" id=\"btngetmobilecode\" class=\"btn_gray2 btnGet black1 f14\">获取短信动态码</a>");
               	            mobilecodetime = 100;
               	            $("#dtmNum_tip").html("");
	                	 }else{
	                		$("#sendsmsbutton").html("<span class=\"btn_gray2 f14\">重新获取短信动态码（<em>" + mobilecodetime-- + "</em>）</span>");
	                	 }
	               }, 1000);
	        }else if(times == "error3"){
				getmobilecodehander = null;
				getmobilecodetime(btnid);
				getmobilecodehander = setInterval(function() {
					if(mobilecodetime <= 0) {
						window.clearInterval(getmobilecodehander);
						getmobilecodehander = null;
						$("#sendsmsbutton").html("<a href=\"javascript:void(0)\" onclick=\"getmobilecodecommon('btngetmobilecode','phoneNum_tip','phoneNum');\" id=\"btngetmobilecode\" class=\"btn_gray2 btnGet black1 f14\">获取短信动态码</a>");
						mobilecodetime = 100;
						$("#dtmNum_tip").html("");
					}else{
						$("#sendsmsbutton").html("<span class=\"btn_gray2 f14\">重新获取短信动态码（<em>" + mobilecodetime-- + "</em>）</span>");
					}
				}, 1000);
	        }else{
	        	$("#"+tipid).html("系统繁忙，请稍后再试");
	        }
		});
	}
	return isOk;
}

/**找回密码第二步**/
function forgetsecond(input1,input2,input3){
	var pagetype = $("#pagetype").val();
	var dtmNum = "";
	if(pagetype == 'mobile'){
		dtmNum = $("#" + input1).val();
		if(dtmNum == null || dtmNum == ''){
			$("#dtmNum_tip").html("请输入短信验证码");
			$("#" + input1).focus();
			return false;
		}else{
			$("#dtmNum_tip").html("");
		}
	}
	var pwdRepeat = $("#" + pwdRepeat).val();
	if(!newcheckpwd("newPwd","newPwd_tip") || !newcheckrepwd("newPwd","pwdRepeat_tip","pwdRepeat")){
		return false;
	}
	url_remote = "userForgetVerify.action";
	var datapost = {
		"usertype":"first002",
		"password":$("#" + input2).val(),
		"repassword":$("#" + input3).val(),
		"mobilecode":dtmNum,
		"username":$("#phoneNum").val(),
		"forgettype":$("#pagetype").val(),
	};
	url_remote = encodeURI(url_remote);
	$.post(url_remote, datapost, function(data) {
		var items1 = data.getElementsByTagName("item");
        var result = items1[0].childNodes[0].nodeValue;
        if(result == "success"){
        	document.forgetform.action = spider_host + "/forgetPasswordSuccess.html";
        	document.forgetform.submit();
        }else if(result == "error1"){
        	$("#newPwd_tip").html("请设置密码或确认设置的密码");
			$("#newPwd").focus();
			return false;
        }else if(result == "error2"){
        	$("#pwdRepeat_tip").html("两次密码输入不一致");
			$("#pwdRepeat").focus();
			return false;
        }else if(result == "error3"){
        	$("#pwdRepeat_tip").html("请返回重新找回密码");
			return false;
        }else if(result == "error4"){
        	$("#dtmNum_tip").html("短信验证码错误");
        	$("#dtmNum").focus();
			return false;
        }else if(result == "error5"){
        	$("#pwdRepeat_tip").html("请返回重新找回密码");
			return false;
        }else if(result == "error6"){
        	$("#pwdRepeat_tip").html("请返回重新找回密码");
			return false;
        }else{
        	$("#pwdRepeat_tip").html(result);
			return false;
        }
	});
}

/**注册成功后重发邮件**/
function sendRegstEmail(){
	url_remote = "sendRegstEmail.action?regemail=" + $("#regemail").val();
	url_remote = encodeURI(url_remote);
	$.post(url_remote, null, function(data) {
		
	});
	alert("发送成功，请至邮箱查收");
}

/**重发忘记密码的邮件**/
function sendForgetEmail(){
	var url_remote = "userForgetVerify.action?usertype=first001&resendflag=y&username="+$("#useremail").val();
	url_remote = encodeURI(url_remote);
	$.post(url_remote, null, function(data) {
		var items = data.getElementsByTagName("item");
		var result = items[0].childNodes[0].nodeValue;
		if(result == 'success'){
			alert("发送成功，请至邮箱查收");
		}else{
		    alert("发送失败");
		}
		return;
	});
}

/**获取url参数值**/
function getUrlParam(name){
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
	var r = window.location.search.substr(1).match(reg);  //匹配目标参数
	//返回参数值
	if(r != null){
		return unescape(r[2]);
	}else{
		return "";
	}
}